/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ClientGui.java
 *
 * Created on Nov 29, 2009, 1:41:04 PM
 */

package sahd.broker.client;

import java.io.IOException;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Observer;
import sahd.broker.proxys.ProxyClient;
import sahd.nicTools.NICTool;

/**
 *
 * @author Romms
 */
public class Client{

    private ProxyClient proxyClient;

    public Client(Observer messagesListener, int outPort, int entryPort, int serviceResponsePort,
        String initialReceiverIpAddress) throws UnknownHostException, SocketException{
        
        proxyClient = ProxyClient.getInstance(messagesListener, outPort,entryPort,serviceResponsePort,
                initialReceiverIpAddress);
        
        this.registerClient();
    }

    //Services
    protected void registerClient(){
        try {
            ClientMachine clientMachine= new ClientMachine(NICTool.getNICIPAddress(), NICTool.getNICMacAddress());
            this.proxyClient.shipMessage(clientMachine, ClientProtocol.REGISTER_CLIENT);
        } catch (IOException ex) {
            //
        }
    }



}
